import request from "@/utils/request";

export function getEmployee(params) {
  return request({
    url: "/sys/user",
    params,
  });
}

export function exportEmployee() {
  return request({
    url: "/sys/user/export",
    responseType: "blob",
  });
}

export function importEmployee(data) {
  return request({
    url: "/sys/user/import",
    method: "post",
    data,
    // responseType: "blob",
  });
}

export function getExportTemplate() {
  return request({
    url: "/sys/user/import/template",
    responseType: "blob",
  });
}

export function delEmployee(id) {
  return request({
    url: `/sys/user/${id}`,
    method: "delete",
  });
}

export function addEmployee(data) {
  return request({
    url: "/sys/user",
    method: "post",
    data,
  });
}

export function getEmployeeDetail(id) {
  return request({
    url: `/sys/user/${id}`,
  });
}

export function updateEmployee(data) {
  return request({
    url: `/sys/user/${data.id}`,
    method: "put",
    data,
  });
}

export function getRoleList() {
  return request({
    url: "/sys/role/list/enabled",
  });
}
/**
 * 分配员工角色
 */

export function assignRoles(data) {
  return request({
    url: "/sys/user/assignRoles",
    method: "put",
    data,
  });
}
